import bb.cascades 1.2

Container {
    id: root
    property string title
    property alias favourite: fav.checked
    property alias checkable: cbcnt.visible
    property alias checked: cb.checked
    property bool favouriteDisabled
    
    Container {
        layout: StackLayout {
            orientation: LayoutOrientation.LeftToRight
        }
        //description: ListItemData.phone.toString()
        ImageToggleButton {
            id: fav
            enabled: !favouriteDisabled
            imageSourceDefault: "asset:///images/icons/ic_favorite.png"
            imageSourceChecked: "asset:///images/icons/ic_favorite_checked.png"
            imageSourceDisabledChecked: "asset:///images/icons/ic_favorite_checked.png"
            imageSourceDisabledUnchecked: "asset:///images/icons/ic_favorite.png"
            imageSourcePressedChecked: "asset:///images/icons/ic_favorite_checked.png"
            imageSourcePressedUnchecked: "asset:///images/icons/ic_favorite.png"
            layoutProperties: StackLayoutProperties {
                spaceQuota: -1
            }
        }
        Container {
            horizontalAlignment: HorizontalAlignment.Fill
            verticalAlignment: VerticalAlignment.Fill
            topPadding: 20
            layoutProperties: StackLayoutProperties {
                spaceQuota: 1
            }
            Label {
                text: root.title
                textStyle.fontSize: FontSize.Large
            }
            onTouch: {
                if (event.touchType == TouchType.Up) {
                    cb.checked != cb.checked;
                }
            }
        }
        Container {
            id: cbcnt
            visible: checkable
            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Center
            rightPadding: 15
            leftPadding: 15
            layoutProperties: StackLayoutProperties {
                spaceQuota: -1
            }
            CheckBox {
                id: cb
            }
        }
    }
    Divider {
    
    }
}